package com.lqm.web.controller;

import com.lqm.dao.HomeUserDao;
import com.lqm.entity.home.HomeUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: CrowdFunding
 * @description
 * @author: lqm
 * @create: 2018-12-07 16:01
 */
@RestController
public class TestController {
    @Autowired
    HomeUserDao homeUserDao;

    @RequestMapping("/t1")
    public List t() {
//        List<HomeUser> all = homeUserDao.findAll();
//        System.out.println(all);
        Sort sort = new Sort(Sort.Direction.ASC, "id");
        Pageable pageable = PageRequest.of(0, 5, sort);
        Page<HomeUser> all = homeUserDao.findAll(pageable);
        return all.getContent();
    }
}
